package com.leyou.common.threadlocals;

import com.leyou.common.auth.entity.UserInfo;

/**
 * @package com.leyou.common.threadlocals
 * @description: 线程信息存储类
 * @author: 许超越
 * @date 2019/7/10 20:24
 * @version: V1.0
 */
public class UserHolder {

    private static final ThreadLocal<UserInfo> TL = new ThreadLocal<>();


    public static void setUser(UserInfo userId) {
        TL.set(userId);
    }

    public static UserInfo getUser() {
        return TL.get();
    }

    public static void removeUser() {
        TL.remove();
    }
}
